﻿CREATE TABLE [dbo].[GamingSession] (
    [GamingSessionId] INT            IDENTITY (1, 1) NOT NULL,
    [BoardGameId]     INT            NOT NULL,
    [UserId]           INT            NOT NULL,
    [StartDate]        DATETIME       NOT NULL,
    [EndDate]          DATETIME       NOT NULL,
    [CreatedBy]        NVARCHAR (256) NOT NULL,
    [CreateDate]       DATETIME       NOT NULL,
    [ModifiedBy]       NVARCHAR (256) NOT NULL,
    [ModifyDate]       DATETIME       NOT NULL,
    CONSTRAINT [PK_GamingSessionId] PRIMARY KEY CLUSTERED ([GamingSessionId] ASC),
    CONSTRAINT [FK_GamingSession_IsOf_BoardGame] FOREIGN KEY ([BoardGameId]) REFERENCES [dbo].[BoardGame] ([BoardGameId]),
    CONSTRAINT [FK_GamingSession_IsOf_User] FOREIGN KEY ([UserId]) REFERENCES [dbo].[User] ([UserId])
);


go
create index IX_GamingSession_BoardGameId on dbo.[GamingSession] (BoardGameId)
go
create index IX_GamingSession_UserId on dbo.[GamingSession] ([UserId])
go

